package com.fit.entities.manytomany;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Table;


@Entity
@Table(name="User_Language")
@AssociationOverrides({
	@AssociationOverride(name = "pk.user", joinColumns = @JoinColumn(name = "user_id")),
	@AssociationOverride(name = "pk.language", joinColumns = @JoinColumn(name = "language_id")) })

public class UserLanguage {
	
	@EmbeddedId
	private UserLanguagePk pk = new UserLanguagePk();
	@Column(name="understanding", nullable=false)
	private String understanding;
	@Column(name="speaking", nullable=false)
	private String speaking;
	@Column(name="writing", nullable=false)
	private String writing;
	
	
	public UserLanguagePk getPk() {
		return pk;
	}
	public void setPk(UserLanguagePk pk) {
		this.pk = pk;
	}
	public String getUnderstanding() {
		return understanding;
	}
	public void setUnderstanding(String understanding) {
		this.understanding = understanding;
	}
	public String getSpeaking() {
		return speaking;
	}
	public void setSpeaking(String speaking) {
		this.speaking = speaking;
	}
	public String getWriting() {
		return writing;
	}
	public void setWriting(String writing) {
		this.writing = writing;
	}
	
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		UserLanguage that = (UserLanguage) o;

		if (getPk() != null ? !getPk().equals(that.getPk())
				: that.getPk() != null)
			return false;

		return true;
	}
	

}
